Skip to content

Move webpack implementation into package folder#94129

Draft
timneutkens wants to merge 9 commits into
canaryfrom
codex/move-webpack-folder
Draft

Move webpack implementation into package folder#94129
timneutkens wants to merge 9 commits into
canaryfrom
codex/move-webpack-folder

Conversation

@timneutkens
Copy link
Copy Markdown
Contributor

What?

Move the webpack implementation into packages/next/src/webpack inside the next package, with lazy Next core integration for webpack/rspack paths. Keep shared Babel and Sass compatibility code in neutral core build locations, including resolve-url-loader under packages/next/src/build/resolve-url-loader.

Why?

Webpack is now opt-in, and keeping its implementation in a dedicated folder makes the support code easier to remove cleanly in the future while preserving next --webpack and config.webpack behavior.

How?

Relocated webpack build/dev/loaders/plugins/vendor files under src/webpack, added next/dist/webpack/next-integration as the internal lazy integration entry, moved shared manifest/trace/dev-page types to neutral core modules, updated Next-owned tests/scripts/storybook references, and adjusted package build output so webpack files compile to dist/webpack. Generated webpack bundles and compiled webpack vendor files are ignored at their new paths.

Verification

  • pnpm --filter=next build
  • pnpm --filter=next types
  • pnpm pack-next --no-js-build --tar
  • NEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-webpack test/e2e/webpack-require-hook/webpack-require-hook.test.ts
  • NEXT_TEST_PREFER_OFFLINE=1 pnpm test-start-webpack test/production/webpack-config-mainjs/webpack-config-mainjs.test.ts
  • NEXT_TEST_PREFER_OFFLINE=1 pnpm test-start-rspack test/e2e/hello-world/hello-world.test.ts
  • NEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-turbo test/e2e/app-dir/scss/basic-module/basic-module.test.ts
  • NEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-webpack test/e2e/app-dir/scss/basic-module/basic-module.test.ts
  • pnpm jest test/unit/next-babel-loader-dev.test.ts test/unit/next-babel-loader-prod.test.ts
  • pre-commit lint-staged

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Stats cancelled

Commit: 765108e
View workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Failing test suites

Commit: 765108e | About building and testing Next.js

pnpm test-dev test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts (job)

  • instant-navigation-testing-api > renders runtime-prefetched content instantly during navigation (DD)
Expand output

● instant-navigation-testing-api › renders runtime-prefetched content instantly during navigation

locator.waitFor: Timeout 60000ms exceeded.
Call log:
  - waiting for locator('[data-testid="search-param-value"]') to be visible

  105 |         '[data-testid="search-param-value"]'
  106 |       )
> 107 |       await searchParamValue.waitFor({ state: 'visible' })
      |                              ^
  108 |       expect(await searchParamValue.textContent()).toContain(
  109 |         'myParam: testValue'
  110 |       )

  at waitFor (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:107:30)
  at instant (../packages/next-playwright/dist/index.js:50:16)
  at Object.<anonymous> (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:99:5)

pnpm test-dev test/development/app-dir/hmr-intercept-routes/hmr-intercept-routes.test.ts (job)

  • hmr-intercept-routes > should update intercept routes via HMR (DD)
Expand output

● hmr-intercept-routes › should update intercept routes via HMR

page.waitForSelector: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('#default-intercept') to be visible

  545 |
  546 |     return this.startChain(async () => {
> 547 |       const el = await page.waitForSelector(selector, {
      |                             ^
  548 |         timeout,
  549 |         state,
  550 |       })

  at waitForSelector (lib/browsers/playwright.ts:547:29)
  at Playwright._chain (lib/browsers/playwright.ts:677:23)
  at Playwright._chain [as startChain] (lib/browsers/playwright.ts:658:17)
  at Playwright.startChain [as waitForElementByCss] (lib/browsers/playwright.ts:546:17)
  at Object.waitForElementByCss (development/app-dir/hmr-intercept-routes/hmr-intercept-routes.test.ts:38:21)

pnpm test-dev-turbo test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts (turbopack) (job)

  • instant-navigation-testing-api > renders runtime-prefetched content instantly during navigation (DD)
Expand output

● instant-navigation-testing-api › renders runtime-prefetched content instantly during navigation

locator.waitFor: Timeout 60000ms exceeded.
Call log:
  - waiting for locator('[data-testid="search-param-value"]') to be visible

  105 |         '[data-testid="search-param-value"]'
  106 |       )
> 107 |       await searchParamValue.waitFor({ state: 'visible' })
      |                              ^
  108 |       expect(await searchParamValue.textContent()).toContain(
  109 |         'myParam: testValue'
  110 |       )

  at waitFor (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:107:30)
  at instant (../packages/next-playwright/dist/index.js:50:16)
  at Object.<anonymous> (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:99:5)

Comment thread packages/next/src/webpack/build/entries.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant